package com.neuedu.cockpit.service.impl;

import java.util.List;

import com.neuedu.cockpit.common.Encode;
import com.neuedu.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.neuedu.cockpit.mapper.HmMediaMapper;
import com.neuedu.cockpit.domain.HmMedia;
import com.neuedu.cockpit.service.IHmMediaService;

/**
 * 多媒体信息Service业务层处理
 * 
 * @author neuedu
 * @date 2024-04-25
 */
@Service
public class HmMediaServiceImpl implements IHmMediaService 
{
    @Autowired
    private HmMediaMapper hmMediaMapper;

    /**
     * 查询多媒体信息
     * 
     * @param id 多媒体信息主键
     * @return 多媒体信息
     */
    @Override
    public HmMedia selectHmMediaById(Long id)
    {
        return hmMediaMapper.selectHmMediaById(id);
    }

    /**
     * 查询多媒体信息列表
     * 
     * @param hmMedia 多媒体信息
     * @return 多媒体信息
     */
    @Override
    public List<HmMedia> selectHmMediaList(HmMedia hmMedia)
    {
        hmMedia.setFileName(Encode.encodeStr(hmMedia.getFileName()));
        hmMedia.setResourceName(Encode.encodeStr(hmMedia.getResourceName()));
        hmMedia.setAuthor(Encode.encodeStr(hmMedia.getAuthor()));
        return hmMediaMapper.selectHmMediaList(hmMedia);
    }

    @Override
    public List<HmMedia> selectHmMediaListOrderByLike(HmMedia hmMedia) {
        return hmMediaMapper.selectHmMediaListOrderByLike(hmMedia);
    }

    /**
     * 新增多媒体信息
     * 
     * @param hmMedia 多媒体信息
     * @return 结果
     */
    @Override
    public int insertHmMedia(HmMedia hmMedia)
    {
        hmMedia.setCreateTime(DateUtils.getNowDate());
        return hmMediaMapper.insertHmMedia(hmMedia);
    }

    /**
     * 修改多媒体信息
     * 
     * @param hmMedia 多媒体信息
     * @return 结果
     */
    @Override
    public int updateHmMedia(HmMedia hmMedia)
    {
        hmMedia.setUpdateTime(DateUtils.getNowDate());
        return hmMediaMapper.updateHmMedia(hmMedia);
    }

    /**
     * 批量删除多媒体信息
     * 
     * @param ids 需要删除的多媒体信息主键
     * @return 结果
     */
    @Override
    public int deleteHmMediaByIds(Long[] ids)
    {
        return hmMediaMapper.deleteHmMediaByIds(ids);
    }

    /**
     * 删除多媒体信息信息
     * 
     * @param id 多媒体信息主键
     * @return 结果
     */
    @Override
    public int deleteHmMediaById(Long id)
    {
        return hmMediaMapper.deleteHmMediaById(id);
    }
}
